import {defineStore} from "pinia";
import cache from "@/utils/cache";

export const globalStore = defineStore("globalStore", {
    state: () => ({
        mobile: false, //移动端布局
        menuIsCollapse: false, //多标签栏
        application: cache.getConfiguration(),
    }),
    actions: {
        isMobile(mobile: boolean) {
            this.mobile = mobile;
        },
        toggleMenuIsCollapse() {
            this.menuIsCollapse = !this.menuIsCollapse;
        },
        setConfiguration(value: any) {
            this.application = value;
            cache.setConfiguration(this.application)
        }
    },
});